<%@ page contentType="text/html;charset=GBK" %>
<%@ page import="java.util.*" %>
<%@ page import="com.ionglobal.db.*" %>
<%@ page import="com.ionglobal.lib.*" %>
<%@ page import="com.ionglobal.vms.*" %>
<%@ page import="com.ionglobal.misc.*" %>

<%@ include file="../init_include.jsp" %>

<%
	Category cat;
	Integer catId;
	int totalpages,pageid=0;
	int pagerows=Page.getPageRows();
	int totalrows=0;
  String ordermode="desc";
  String orderfield="sys_class.id";
	
	int check_rst=Permission.accept(dbi,session,request,"sysop","tree","catid","000000010"); 

	if(request.getParameter("ordermode")!=null)
		ordermode=request.getParameter("ordermode");	
	if(request.getParameter("orderfield")!=null)
		orderfield=request.getParameter("orderfield");	
	
	if (check_rst!=Permission.CHECK_RST_SUCCESS)
	{
		dbi.closeAll();
		if (check_rst==Permission.CHECK_RST_DENY)
			response.sendRedirect("../deny.html");
		else
			response.sendRedirect("../index.jsp");
		return;		
	}	
	
	String a=request.getParameter("catid");
	String str="";
	try {
		catId=Integer.valueOf(a);		
	} catch(NumberFormatException e) {
		out.println(e+"catId");
		return;
	}
	
	try {
		if (request.getParameter("pageid")!=null)
			pageid=Integer.parseInt(request.getParameter("pageid"));
	} catch(NumberFormatException e) {
		out.println(e+"pageid");
	}	
	
	try {
		if (request.getParameter("pagerows")!=null)
			pagerows=Integer.parseInt(request.getParameter("pagerows"));
	} catch(NumberFormatException e) {
		out.println(e+"pagerows");
	}	

	String idarray="";
	if(request.getParameter("id")!=null)
		idarray=request.getParameter("id");
%>	
<html>
<head>
<title><%=Language.getNameByCode("sys.sysop.class","View user and it's group")%></title>
<meta http-equiv="Content-Type" content="text/html; charset=<%=Language.getHTMLLanguageStr()%>">
<link rel="stylesheet" href="../css.css" type="text/css">
<SCRIPT language=JavaScript1.2 src="../script/Ion_Show.js"></SCRIPT>
<script language="javascript">
<!--
	function setClass(titlename)
	{
		var deleteitem=selectlist();
		if(titlename==null || titlename=="")
			titlename="object";
		if(window.formIon.objid.value=="" | window.formIon.objid==null) {
				window.alert(<%=Language.getNameByCode("sys.class.setpri","\"please select \"+titlename+\"!\"")%>);	
				return ;
		} else {
				if(!window.confirm(<%=Language.getNameByCode("sys.class.confirmpri","\"Do you confirm to opertion?\"")%>))
					return ;
		}
		location.href="archive_set_class.jsp?catid="+window.formIon.catid.value+"&idarray="+window.formIon.id.value+"&id="+deleteitem;
	}	
-->
</script>
</head>

<body bgColor=#d6d3ce leftMargin=0 
style="BORDER-BOTTOM: 0px outset; BORDER-LEFT: 0px outset; BORDER-RIGHT: 0px outset; BORDER-TOP: 0px outset" 
topMargin=0>
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
		<FORM name="formIon" method="post" action="user_class_list.jsp">
   	<tr>
    	 <td><%=Language.getNameByCode("sys.sysop.class","View user and it's group")%></td>
   	</tr>
	</table>

	<TABLE border=0 cellPadding=0 cellSpacing=1 height="100%" width="100%">
		<input type="hidden" name="catid" value="<%=catId%>">
		<input type="hidden" name="id" value="<%=idarray%>">
		<INPUT name="objid" type="hidden">
		<INPUT name="objtext" type="hidden">
		<INPUT name="actionurl" type="hidden">
		<input type="hidden" name="orderfield" value="<%=orderfield%>">
		<input type="hidden" name="ordermode" value="<%=ordermode%>">
  	<TR>
    <TD>
    <%
    DictApp da=new DictApp();
    Properties TypeP=da.getDictProperties(dbi,"ProjectType",1,0,"sName","asc");
    Properties StatusP=da.getDictProperties(dbi,"ProjectStatus",1,0,"sName","asc");
    
    Table table=new Table();
    table.setSortMode(ordermode);
    table.setSortField(orderfield);
    table.setSelectionMode("multiple");
    table.addColumn("no","id",0,"center","left","number");
    table.addColumn(Language.getNameByCode("sys.class.id","ID"),"id",30,"center","left","text");
    table.addColumn(Language.getNameByCode("sys.class.name","Name"),"name",100,"center","left","text");
    table.addColumn(Language.getNameByCode("sys.class.descript","Descript"),"descript",400,"center","left","text");

    ArrayList rowsList=new ArrayList();
    try {
     //ArrayList ar=newProjectApp.getProjectList(dbi,pageid,pagerows,orderfield+" "+ordermode);
	 Vector vc=Classes.getClasses(dbi,0,0);
     String rowData="";
	 int curlayer=0;
     for(int i=0;i<vc.size();i++) {
        Classes classes=(Classes)vc.get(i);
      	String space="";
	    for(int j=curlayer;j<=classes.getLayer();j++)
			space+=">>";
	    rowData=classes.getId()+"|"+classes.getId()+"|"+space+classes.getName()+"|"+(classes.getDescript()+" ");
        rowsList.add(rowData);
     }
    } catch(Exception E) {
    }
    ArrayList menuList=new ArrayList();
    TableMenu tm=null;
    tm=new TableMenu(Language.getNameByCode("sys.class.tocategory","Grand group to category"),"javascript:setClass('"+Language.getNameByCode("sys.class","group")+"');",true);
    menuList.add(tm);
    tm=new TableMenu(Language.getNameByCode("sys.Head.Refresh","Refresh"),"javascript:self.location.reload();",false);
    menuList.add(tm);

    table.setTableMenu(menuList);
    table.setRowsList(rowsList);
    TableDB tdb=new TableDB();
    out.print(tdb.draw(table));
    %>

    </TD>
 	</TR>
 	</FORM>
	</TABLE>
</body>
</html>
<%@ include file="../init_free.jsp" %>	
